#!/usr/bin/env python # coding: utf8 # -*- coding: utf-8 -*- # Quelle: http://rdrpostagger.sourceforge.net/ # https://github.com/dominedo/spark-n-spell import SpellcheckerSymspell import time from SpellcheckerSymspell import * ''' Sebastian: 17.01.2016 todo: 1. Create simple TCP AND Unix Socket Server 2. then use only UNIX Socket 3. while starting server, the Spellchecker trains the Dictionary 4. Create dictionary with over 3 Million Sentences to learn 5. later: buy good German dictionary -> talk with Gerhard Später bei output[0] ein Content Dumper einbauen, damit ich sehen kann, was drin steht, bevor der output zurück geht und ich den "IndexError: list index out of range" beheben kann ''' text = "Ich essse ein Eis und gehe spasieren." dictonary = "/home/www/www.onetipp.com/python/dict/text.txt" start_time = time.time() try: SpellcheckerSymspell.create_dictionary(dictonary) except: SpellcheckerSymspell.create_dictionary(dictonary) run_time = time.time() - start_time print('-----') print('%.2f seconds to run' % run_time) print('-----') print(" ") print("Word correction") print("---------------") while True: word_in = raw_input('Enter your input (or enter to exit): ') if len(word_in)==0: print("goodbye") break start_time = time.time() print(SpellcheckerSymspell.get_suggestions(word_in)) run_time = time.time() - start_time print('-----') print('%.5f seconds to run' % run_time) print('-----') print(" ")